// 设置 el-table 的 cell 值为空时显示的字符

export const getElCellEmptyText = (row, column, emptyText = '') => {
    const key = column.prototype || column.prop;
    const val = row[key];
    if (val === undefined || val === null) {
        return emptyText;
    }
    return val;
};

// 用于 el-table 的 cell 的格式化工具，接受 column.formatter 作为参数，返回格式化后的字符

export const formatterElCellContent = (formatter, row, column) => {
    if (formatter && typeof formatter === 'function') {
        return formatter(row, column) || getElCellEmptyText(row, column);
    }
    return getElCellEmptyText(row, column);
};
